package com.gym.service.impl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.gym.dao.TrainDao;
import com.gym.pojo.Personaltrainer;
import com.gym.pojo.Train;
import com.gym.service.TrainService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class TrainServiceImpl implements TrainService {
    @Resource
    private TrainDao trainDao;



    @Override
    public boolean insertjl(Train train) {
        return trainDao.insertjl(train)>0;
    }

    @Override
    public boolean insertsjd(Personaltrainer pr) {
        return trainDao.insertsjd(pr)>0;
    }

    @Override
    public boolean updatejl(Train train) {
        return trainDao.updatejl(train)>0;
    }

    @Override
    public boolean deletejl(int trainId) {
        return trainDao.deletejl(trainId)>0;
    }

    @Override
    public Train selectjlid(int trainId) {
        return trainDao.selectjlid(trainId);
    }

    @Override
    public PageInfo<Train> selectjl(String trainname, int index, int size) {
        PageHelper.startPage(index, size);
        PageInfo<Train> page =new PageInfo<Train>(trainDao.selectjl(trainname),5);
        return page;
    }

    @Override
    public boolean deletesj(int trainId) {
        return trainDao.deletesj(trainId)>0;
    }

    @Override
    public boolean deletesjs(int personalId) {
        return trainDao.deletesjs(personalId)>0;
    }

    @Override
    public List<Train> selectsjd() {
        return trainDao.selectsjd();
    }

    @Override
    public boolean selectycz(String trainname) {
        return trainDao.selectycz(trainname)>0;
    }
}
